package com.bzframework.pro.enums;

import lombok.Getter;
import lombok.RequiredArgsConstructor;

/**
 * @Author bingzhong
 * @Date 2025/4/10 18:17
 * @Description
 */
@Getter
@RequiredArgsConstructor
public enum GenderEnum {

    other("其它","0"),

    male("男","1"),

    /**
     * 女性
     */
    female("女","2");

    private final String name;

    private final String value;

    /**
     * 根据value获取对应的枚举
     * @param value 枚举值
     * @return 对应的枚举对象，找不到时返回null
     */
    public static GenderEnum of(String value) {
        for (GenderEnum gender : GenderEnum.values()) {
            if (gender.getValue().equals(value)) {
                return gender;
            }
        }
        return GenderEnum.other;
    }


}
